@extends('store::layout')
@section('content')
    <div class="row mb-5"><div class="col-sm-12">
            @if($info->has_money>0 &&($user->info->alipay || $user->info->weichat ||$user->info->bank_card))
                @component('store::component.form.form')
                    @slot('action') {{route('Store_Finance_wdApply')}} @endslot
                    @slot('formId') goods @endslot
                    @component('store::component.form.form-group')
                        @slot('title') 提现金额 @endslot
                        @slot('is_must') true @endslot
                        @component('store::component.form.input-group')
                            @slot('input')
                                    @component('store::component.form.input')
                                        @slot('name') money @endslot
                                        @slot('value')  @endslot
                                    @endcomponent
                            @endslot
                                @slot('button')
                                    @component('store::component.form.button')
                                        @slot('title')全部提现@endslot
                                        @slot('size') md @endslot
                                        @slot('color') danger @endslot
                                        @slot('attr') onclick = wdAll(this,{{$info->has_money}}) data-target=money @endslot
                                    @endcomponent
                                @endslot

                        @endcomponent

                        @slot('remark') 当前未结算金额:{{$info->has_money}} @endslot
                    @endcomponent

                    @component('store::component.form.form-group')
                            @slot('title') 结算账户 @endslot
                            @slot('is_must') true @endslot
                            @php
                                $options = [];
                                if($user->info->bank_card){
                                    $options[1] = '银行卡';
                                }
                                if($user->info->weichat){
                                    $options[2] = '微信';
                                }
                                if($user->info->alipay){
                                    $options[3] = '支付宝';
                                }
                            @endphp
                            @component('store::component.form.select',['options'=>$options])
                                @slot('name') account_type @endslot
                                @slot('value')  @endslot
                            @endcomponent

                        @endcomponent

                    @component('store::component.form.form-group')
                            @slot('title') 备注 @endslot
                            @component('store::component.form.textarea')
                                @slot('name') remark @endslot
                                @slot('row') 2 @endslot
                                @slot('value')  @endslot
                            @endcomponent
                        @endcomponent

                    @component('store::component.form.form-group')
                        @slot('title') 收款账户 @endslot
                        @slot('is_must') true @endslot
                            <p class="card-text text-danger">手机号:{{$user->user_phone}} <code>姓名:{{$user->real_name}}</code></p>
                            <p class="card-text text-danger">支付宝:{{$user->info->alipay ?? '无'}}</p>
                            <p class="card-text text-danger">微信:{{$user->info->weichat ?? '无'}}</p>
                            <p class="card-text text-danger">银行卡:{{$user->info->bank_card ?? '无'}}</p>
                            <p class="card-text text-danger">开户行:{{$user->info->bank_name ?? '无'}}</p>
                    @endcomponent

                    @component('store::component.form.form-group')
                        @slot('class') text-left m-b-0 @endslot
                        @component('store::component.form.button')
                            @slot('title')确定@endslot
                            @slot('size') md @endslot
                            @slot('color') danger @endslot
                            @slot('params') {"formId":"#goods"} @endslot
                            @slot('class')ajax-form @endslot
                        @endcomponent
                        @component('store::component.form.button')
                            @slot('title') 重置 @endslot
                            @slot('size') md @endslot
                            @slot('color') primary @endslot
                        @endcomponent
                    @endcomponent
                @endcomponent
             @else
                @include('store::public.empty',['info'=>'暂时没有可以结算的资金或账户信息不完善'])
            @endif
        </div></div>
@endsection
@push('scripts')
    <script>
        function wdAll(obj,money) {
            var target = $(obj).data('target');
            $('input[name="'+target+'"]').val(money);
        }
    </script>
@endpush